Specify the display of how non-data components of the plot are drawn and then convert them with ggplotly.
plot <- ggplot(mpg, aes(displ, hwy)) + geom_point()
p <-
plot + theme(
panel.background = element_blank(),
axis.text = element_blank()
)
plotly::ggplotly(p)
plot <- ggplot(mpg, aes(displ, hwy)) + geom_point()
p <-
plot + theme(
axis.text = element_text(colour = "red", size = rel(1.5))
)
plotly::ggplotly(p)
plot <- ggplot(mpg, aes(displ, hwy)) + geom_point()
p <-
plot + theme(
axis.line = element_line(arrow = arrow())
)
plotly::ggplotly(p)
plot <- ggplot(mpg, aes(displ, hwy)) + geom_point()
p <-
plot + theme(
panel.background = element_rect(fill = "white"),
plot.margin = margin(2, 2, 2, 2, "cm"),
plot.background = element_rect(
fill = "grey90",
colour = "black",
size = 1
)
)
plotly::ggplotly(p)